package br.com.sgc.entities.geral;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(schema="geral")
public class Medicacao implements Serializable{

	private static final long serialVersionUID = -9058290288445340934L;
	
	
	@Id
	@SequenceGenerator(sequenceName="geral.seq_medicacao", name="SEQ", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,  generator="SEQ")
	private Long id;
	
	private String nome;
	
	@Column(name="composto_ativo")
	private String compostoAtivo;
	
	@Column(columnDefinition="text")
	private String indicacoes;
	
	@ManyToMany
	@JoinTable(schema="geral",
	joinColumns = {@JoinColumn(name="medicacao_id")},inverseJoinColumns = {@JoinColumn(name="laboratorio_id")})
	private List<Laboratorio> laboratorio = new ArrayList<Laboratorio>();
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="clinica_id")
	private Clinica clinica = new Clinica();
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getCompostoAtivo() {
		return compostoAtivo;
	}

	public void setCompostoAtivo(String compostoAtivo) {
		this.compostoAtivo = compostoAtivo;
	}

	public String getIndicacoes() {
		return indicacoes;
	}

	public void setIndicacoes(String indicacoes) {
		this.indicacoes = indicacoes;
	}

	public List<Laboratorio> getLaboratorio() {
		return laboratorio;
	}

	public void setLaboratorio(List<Laboratorio> laboratorio) {
		this.laboratorio = laboratorio;
	}

	public Clinica getClinica() {
		return clinica;
	}

	public void setClinica(Clinica clinica) {
		this.clinica = clinica;
	}
}
